package com.huan.partitioner_sort;


import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class ProvincePartitioner extends Partitioner<FlowBean,Text> {




    @Override
    public int getPartition(FlowBean key, Text values, int numPartitions) {
        int partition = 4;

        String substring = values.toString().substring( 0, 3 );

        if("136".equals( substring )){
            partition = 0;
        }else if("137".equals( substring )){
            partition = 1;
        }else if("138".equals( substring )){
            partition = 2;
        }else if("139".equals( substring )){
            partition = 3;
        }

        return partition;
    }
}
